package com.gitee.feizns.dynamic.convert.impl;

import com.gitee.feizns.dynamic.convert.AbstractConverter;
import com.gitee.feizns.dynamic.convert.Converter;

/**
 * <b>将任意类型转换为String类型的转换器</b>
 * @see Converter
 * @see AbstractConverter
 * @author feizns
 * @since 2019/6/15 0015
 */
public class ToStringConverter extends AbstractConverter<Object, String> {

    @Override
    public String to(Object source, Class<String> targetType) {
        return source != null ? source.toString() : null;
    }

    @Override
    public boolean support(Object source, Class<?> targetType) {
        return String.class == targetType;
    }

}
